package main;

import java.io.File;
import java.util.Map;
import java.util.Scanner;

import junit.framework.TestCase;

import org.junit.Test;

public class TestMain extends TestCase {
	
	@Test
	public void test() throws Exception {
		Main m = new Main();
		Map<String, Double> result = m.results;
		
		Scanner scan = new Scanner(new File("lab4/closest-pair.out"));
		while (scan.hasNext()) {
			String[] s = scan.nextLine().split(" ");
			String fname = s[0].substring(s[0].lastIndexOf("/")+1);
			fname = fname.replace(":", "");
			double res = Double.parseDouble(s[2]);
			assertEquals("fail: "+ fname, res, result.get(fname), 0.001);
		}
	}
}
